home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form SalesMix
- BackColor = &H00E0FFFF&
- Caption = "Sales Mix File Maintenance"
- Height = 1875
- Icon = SALESMIX.FRX:0000
- Left = 1290
- LinkMode = 1 'Source
- LinkTopic = "SalesMix"
- MaxButton = 0 'False
- MDIChild = -1 'True
- ScaleHeight = 1470
- ScaleWidth = 6225
- Top = 2130
- Width = 6345
- Begin CommandButton CmdClose
- Caption = "&Close"
- Height = 375
- Left = 5280
- TabIndex = 10
- Top = 960
- Width = 855
- End
- Begin CommandButton CmdCancel
- Cancel = -1 'True
- Caption = "Cancel"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 4440
- TabIndex = 9
- Top = 960
- Width = 855
- End
- Begin CommandButton CmdDelete
- Caption = "&Delete"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 3480
- TabIndex = 8
- Top = 960
- Width = 855
- End
- Begin CommandButton CmdUpdate
- Caption = "&Update"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 2640
- TabIndex = 7
- Top = 960
- Width = 855
- End
- Begin CommandButton CmdAdd
- Caption = "&Add"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 1800
- TabIndex = 6
- Top = 960
- Width = 855
- End
- Begin CommandButton CmdNext
- BackColor = &H00FFFFFF&
- Caption = "&Next"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 825
- TabIndex = 5
- Top = 960
- Width = 735
- End
- Begin CommandButton CmdPrevious
- Caption = "&Previous"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 120
- TabIndex = 4
- Top = 960
- Width = 735
- End
- Begin TextBox Text3
- Height = 375
- Left = 2160
- TabIndex = 3
- Top = 480
- Width = 1140
- End
- Begin TextBox Text2
- Height = 375
- Left = 2160
- TabIndex = 1
- Top = 135
- Width = 1140
- End
- Begin Label LblDesc
- Alignment = 1 'Right Justify
- BackColor = &H00E0FFFF&
- Caption = "&Servings sold:"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 480
- Width = 1815
- End
- Begin Label LblKey
- Alignment = 1 'Right Justify
- BackColor = &H00E0FFFF&
- Caption = "&Recipe No:"
- Height = 255
- Left = 240
- TabIndex = 0
- Top = 120
- Width = 1695
- End
- Dim EntryMode As String * 1
- Dim FieldError As Integer
- Dim DeactivatedKey As String
- Sub ClearAllFields ()
- EntryMode = "N"
- Text2.Text = ""
- Text3.Text = ""
- Text2.SetFocus
- SetCmdFlags
- End Sub
- Sub ClearDataFields ()
- Text3.Text = ""
- End Sub
- Sub CmdAdd_Click ()
- ErrorCheckFields
- MoveFieldsToRecord
- If Not FieldError Then
- WriteSalesMix
- Select Case SalesMixSt%
- Case 0
- ClearAllFields
- Case 3
- MsgSalesMixNotOpen
- Case 5
- Msg$ = "Sales Mix already on file."
- T1% = MsgBox(Msg$, 0, "Note")
- Text2.SetFocus
- Case Else
- MsgUnknownSalesMixError
- End Select
- End If
- End Sub
- Sub CmdCancel_Click ()
- If EntryMode = "C" Then
- Text2.Text = SalesMixSaveRec.RecNo
- Text3.Text = RTrim$(LTrim$(Str$(SalesMixSaveRec.ServingsSold)))
- Text3.SetFocus
- Text3.SelStart = Len(Text3.Text)
- EntryMode = "U"
- SetCmdFlags
- Else
- ClearAllFields
- End If
- End Sub
- Sub CmdClose_Click ()
- Unload SalesMix
- End Sub
- Sub CmdDelete_Click ()
- Msg$ = "Are you sure?"
- TI% = MsgBox(Msg$, 260, "Delete?")
- If TI% = 6 Then
- DeleteSalesMix
- Select Case SalesMixSt%
- Case 0
- ClearAllFields
- Case 8
- Msg$ = "Record must be found before you can delete."
- Beep
- T1% = MsgBox(Msg$, 0, "Warning!")
- Case 80
- Msg$ = "This record updated since read. Reread and try again."
- Beep
- T1% = MsgBox(Msg$, 0, "Not Deleted!")
- Case Else
- Msg$ = "Sales Mix not deleted. Status = " + Str$(SalesMixSt%)
- Beep
- T1% = MsgBox(Msg$, 0, "Warning!")
- End Select
- End If
- End Sub
- Sub CmdNext_Click ()
- NextSalesMix
- Select Case SalesMixSt%
- Case 0
- DisplayDataFields
- Case 3
- MsgSalesMixNotOpen
- Case 8
- FirstSalesMix
- If SalesMixSt% <> 0 Then
- MsgUnknownSalesMixError
- Else
- DisplayDataFields
- End If
- Case 9
- Msg$ = "End of Sales Mix file."
- T1% = MsgBox(Msg$, 0, "Note")
- Case Else
- MsgUnknownSalesMixError
- End Select
- End Sub
- Sub CmdPrevious_Click ()
- PreviousSalesMix
- Select Case SalesMixSt%
- Case 0
- DisplayDataFields
- Case 3
- MsgSalesMixNotOpen
- Case 8
- FirstSalesMix
- If SalesMixSt% <> 0 Then
- MsgUnknownSalesMixError
- Else
- DisplayDataFields
- End If
- Case 9
- Msg$ = "Beginning of Sales Mix file."
- T1% = MsgBox(Msg$, 0, "Note")
- Case Else
- MsgUnknownSalesMixError
- End Select
- End Sub
- Sub CmdUpdate_Click ()
- EntryMode = "C"
- SalesMixRec.ServingsSold = Text3.Text
- UpdateSalesMix
- Select Case SalesMixSt%
- Case 0
- EntryMode = "N"
- ClearAllFields
- Case 3
- MsgSalesMixNotOpen
- Case 5
- Msg$ = "Sales Mix duplicate on file."
- T1% = MsgBox(Msg$, 0, "Note")
- Case 8
- Msg$ = "Update only works on found records."
- T1% = MsgBox(Msg$, 0, "Note")
- Case 80
- Msg$ = "This record updated since read. Reread and try again."
- T1% = MsgBox(Msg$, 0, "Warning!")
- Case Else
- MsgUnknownSalesMixError
- End Select
- End Sub
- Sub DisplayDataFields ()
- SalesMixSaveRec = SalesMixRec
- Text2.Text = SalesMixRec.RecNo
- Text3.Text = LTrim$(RTrim$(Str$(SalesMixRec.ServingsSold)))
- Text3.SetFocus
- EntryMode = "U"
- SetCmdFlags
- End Sub
- Sub ErrorCheckFields ()
- FieldError = False
- If LTrim$(RTrim$(Text2.Text)) = "" Then
- Msg$ = "Recipe number is required."
- T1% = MsgBox(Msg$, 0, "Note")
- FieldError = True
- Text2.SetFocus
- Exit Sub
- End If
- RecipeRec.RecNo = Text2.Text + String$(6 - Len(Text2.Text), " ")
- ReadRecipe
- If RecipeSt% <> 0 Then
- Msg$ = "Recipe is not on file."
- T1% = MsgBox(Msg$, 0, "Note")
- FieldError = True
- Text2.SetFocus
- Exit Sub
- End If
- If LTrim$(RTrim$(Text3.Text)) = "" Then
- Msg$ = "You must enter servings sold."
- T1% = MsgBox(Msg$, 0, "Note")
- FieldError = True
- Text3.SetFocus
- Exit Sub
- End If
- End Sub
- Sub Form_Activate ()
- If DeactivatedKey <> "" Then
- SalesMixRec.RecNo = DeactivatedKey
- ReadSalesMix
- End If
- End Sub
- Sub Form_Deactivate ()
- DeactivatedKey = SalesMixRec.RecNo
- End Sub
- Sub Form_Load ()
- DeactivatedKey = ""
- ' Top = DeliMain.Top + 660
- ' Left = DeliMain.Left + 660
- Height = 1875
- Width = 6345
- EntryMode = "N"
- SetCmdFlags
- End Sub
- Sub MoveFieldsToRecord ()
- SalesMixRec.RecNo = Text2.Text + String$(6 - Len(Text2.Text), " ")
- SalesMixRec.ServingsSold = Val(Text3.Text)
- End Sub
- Sub SetCmdFlags ()
- Select Case EntryMode
- Case "N"
- CmdPrevious.Enabled = True
- CmdNext.Enabled = True
- CmdCancel.Enabled = False
- CmdAdd.Enabled = True
- CmdUpdate.Enabled = False
- CmdDelete.Enabled = False
- Case "U"
- CmdPrevious.Enabled = True
- CmdNext.Enabled = True
- CmdCancel.Enabled = False
- CmdAdd.Enabled = False
- CmdUpdate.Enabled = True
- CmdDelete.Enabled = True
- Case "C"
- CmdPrevious.Enabled = True
- CmdNext.Enabled = True
- CmdCancel.Enabled = True
- CmdAdd.Enabled = False
- CmdUpdate.Enabled = True
- CmdDelete.Enabled = False
- Case Else
- Msg$ = "Undefined Entry Mode Flag - " + EntryMode + "."
- T1% = MsgBox(Msg$, 0, "Warning!")
- End Select
- End Sub
- Sub Text2_Change ()
- If EntryMode = "U" Then
- EntryMode = "C"
- SetCmdFlags
- End If
- End Sub
- Sub Text2_GotFocus ()
- Text2.SelStart = 0
- Text2.SelLength = Len(Text2.Text)
- End Sub
- Sub Text2_KeyDown (KeyCode As Integer, Shift As Integer)
- If KeyCode = KEY_PAGE_UP Then
- CmdPrevious_Click
- End If
- If KeyCode = KEY_PAGE_DOWN Then
- CmdNext_Click
- End If
- End Sub
- Sub Text2_KeyPress (KeyAscii As Integer)
- If KeyAscii = 13 Then
- RecipeRec.RecNo = Text2.Text + String$(6 - Len(Text2.Text), " ")
- ReadRecipe
- If RecipeSt% = 0 Then
- KeyAscii = 0
- Text3.SetFocus
- Else
- KeyAscii = 0
- MsgBox "Recipe not on file."
- End If
- Else
- UCStrKP Text2, 6, KeyAscii
- End If
- End Sub
- Sub Text2_LostFocus ()
- If Text2.Text <> "" Then
- EntryMode = "N"
- SalesMixRec.RecNo = Text2.Text + String$(6 - Len(Text2.Text), " ")
- ReadSalesMix
- Select Case SalesMixSt%
- Case 0
- DisplayDataFields
- Case 3
- MsgSalesMixNotOpen
- Case 4
- ClearDataFields
- Case Else
- MsgUnknownSalesMixError
- End Select
- SetCmdFlags
- End If
- End Sub
- Sub Text3_Change ()
- If EntryMode = "U" Then
- EntryMode = "C"
- SetCmdFlags
- End If
- End Sub
- Sub Text3_GotFocus ()
- Text3.SelStart = 0
- Text3.SelLength = Len(Text3.Text)
- End Sub
- Sub Text3_KeyDown (KeyCode As Integer, Shift As Integer)
- If KeyCode = KEY_PAGE_UP Then
- CmdPrevious_Click
- End If
- If KeyCode = KEY_PAGE_DOWN Then
- CmdNext_Click
- End If
- End Sub
- Sub Text3_KeyPress (KeyAscii As Integer)
- If KeyAscii = 13 Then
- KeyAscii = 0
- If CmdUpdate.Enabled = True Then
- CmdUpdate.SetFocus
- Else
- CmdAdd.SetFocus
- End If
- Else
- LongKP Text3, 30, KeyAscii
- End If
- End Sub
-